<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>明细数据统计报表</title>
<link href="../css/css.css" rel="stylesheet" type="text/css" />
</head>
#parse("/views/default/defaultValue.vm")
<body>
<script type="text/javascript" src="http://pic2.58.com/n/tuan/js/jquery-1.4.2.min.js"></script>
<script type="text/javascript" src="../javascript/My97DatePicker/WdatePicker.js"></script>
<script type="text/javascript" src="../javascript/report/FusionCharts.js"></script>
<script type="text/javascript" src="../javascript/report/Date.js"></script>
<script >
		function check(){
			var startDate = $("#startDate").val();
			if(startDate == ""){
				alert("请选择起始时间!");
				return false;
			}
			
			var endDate = $("#endDate").val();
			if(endDate == ""){
				alert("请选择截止时间!");
				return false;
			}
			
			if(startDate>endDate){
				alert("截止时间不能大于起始时间!");
				return false;
			}
			
			var startYear = startDate.substring(0,startDate.lastIndexOf("-"));
    		var endYear = endDate.substring(0,endDate.lastIndexOf("-"));
    		if(startYear != endYear){
    			alert("查询时间范围不可跨月！");
    			return false;
    		}
    		$("#down").val(0);
    		return true;
		}
		
		 
		 
		$(function(){
            $("#cateOne").change(function(){
                var cateOne = $("#cateOne").val();
                if(cateOne != "" && cateOne != "全部"){
                    jQuery.ajax({
                    type:"GET",
                    dataType:"json",
                    async:true,
                    url:"/ad/prodtype",
                    data:{"cateOne":cateOne},
                    success:function(data){
                        if(data!=""){
                            var cityitems = "";
    						cityitems = "<option value=''>全部</option>";
                            $.each(data.items, function(i, obj) {
                                cityitems = cityitems + "<option value='"+obj.cate2+"'>"+obj.cate2+"</option>";
                            });
                            $("#cateTwo").empty().append(cityitems);
                        }
                    }
                });
                }else{
					var cityitems ="<option value=''>全部</option>";
					 $("#cateTwo").empty().append(cityitems);
				}
           	 });
   		 });	
		 
		 
		$(function(){
            $("#city1").change(function(){
                var city1 = $("#city1").val();
                if(city1 != "" && city1 !="全部"){
                    jQuery.ajax({
                    type:"GET",
                    dataType:"json",
                    async:true,
                    url:"/precision/citylisttwo",
                    data:{"city1":city1},
                    success:function(data){
                        if(data!=""){
                            var cityitems = "";
    						cityitems = "<option value=''>全部</option>";
                            $.each(data.items, function(i, obj) {
                                cityitems = cityitems + "<option value='"+obj.localName+"'>"+obj.localName+"</option>";
                            });
                            $("#city2").empty().append(cityitems);
                        }
                    }
                });
                }else{
					var cityitems = "<option value=''>全部</option>";
				    $("#city2").empty().append(cityitems);
				}
           	 });
   		 });	
		 
		function choseType(type){
			$("#type").val(type);
		}
		
		$(function(){
		$("#download").click(function(){
			$("#down").val(1);
			document.detaildatastat.submit();
		});
		});
</script>
<div class="lr_both" style="OVERFLOW-X:yes;OVERFLOW-Y:auto" >
<div class="right_conts">
  <div class="mg_tt">
    <div class="right_search">
      <div class="rs_title_bg">
        <h2 class="rs_title">明细数据统计报表</h2>
      </div>
	  </br>
	  <form id="detaildatastat" name="detaildatastat" action="/precision/detaildatastat" method="post" onsubmit="return check();">
	  <input type="hidden" id="down" name="down" value="0"/>
	  <input type="hidden" id="type" name="type" value="$!{type}"/>
      <div class="rs_div" style="height:60px;" > 
		<div pd_text="" style="height:25px;">
			查询类型：
			<input type="radio" id="cc" name="cc" onclick="choseType('0')" #if($type == 0) checked #end/>竞价成功   &nbsp;&nbsp;
			<input type="radio" id="cc" name="cc" onclick="choseType('1')" #if($type == 1) checked #end/>竞价失败
			&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
			起始时间:&nbsp;<input  type="text" id="startDate" name="startDate" class="Wdate" value="$!{startDate}" onclick="WdatePicker({skin:'ext',dateFmt:'yyyy-MM-dd'})"/>
    		&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
			结束时间:&nbsp;<input  type="text" id="endDate" name="endDate" class="Wdate" value="$!{endDate}"   onclick="WdatePicker({skin:'ext',dateFmt:'yyyy-MM-dd'})"/>
			&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
			<input type="submit"   value="查询"/>
			</div>
		
		<div style="height:5px;">
		</div>	
			
		<div style="height:25px;">
			竞价一级城市:&nbsp;
                  <select size="1"  name="city1" id="city1">
					 <option value="" #if (${city1}=="") selected #end>全部</option>
        			 #if ($cityList)        		
        				#foreach($cc in $cityList)
							 #set($str=${cc.ListName}) 
                             #set($str=$str.substring(0,1)) 
							<option value="${cc.LocalName}" #if (${city1}==${cc.LocalName}) selected #end>$tools.UpperFirst($str)-${cc.LocalName}</option>
        				#end
					 #end
                   </select>
				   &nbsp;&nbsp; &nbsp;&nbsp;
			竞价二级城市:&nbsp;
                  <select size="1"  name="city2" id="city2">
					 <option value="" #if (${city2}=="") selected #end>全部</option>
        			 #if ($cityTwoList)        		
        				#foreach($cc in $cityTwoList)
							<option value="${cc.LocalName}" #if (${city2}==${cc.LocalName}) selected #end>${cc.LocalName}</option>
        				#end
					 #end
                   </select>
				    &nbsp;&nbsp; &nbsp;&nbsp;
					
			业务类别:&nbsp;
                 <select size="1"  name="serviceType" id="serviceType">
					<option value="" #if (""== $serviceType) selected #end >全部</option>
					<option value="黄页" #if ("黄页"== $serviceType) selected #end >黄页</option>
					<option value="招聘" #if ("招聘"== $serviceType) selected #end >招聘</option>
					##<option value="二手车" #if ("二手车"== $serviceType) selected #end >二手车</option>
					<option value="二手市场" #if ("二手市场"== $serviceType) selected #end >二手市场</option>
                 </select>	
			&nbsp;&nbsp;&nbsp;&nbsp;
			
			一级类别:&nbsp;
                 <select size="1"  name="cateOne" id="cateOne">
    				#if ($cateOneList)        		
    					<option value="">全部</option>
						#foreach($cate in $cateOneList)
							<option value="${cate.cateName}" #if (${cate.cateName}== $cateOne) selected #end >${cate.cateName}</option>
						#end
                    #end
                 </select>	
			&nbsp;&nbsp;&nbsp;&nbsp;
			二级类别:&nbsp;
                 <select size="1"  name="cateTwo" id="cateTwo">
					<option value="">全部</option>
					#if($cateTwoList)
    					#foreach($cate in $cateTwoList)
    						<option value="${cate.cate2}" #if (${cate.cate2}== $cateTwo) selected #end >${cate.cate2}</option>
						#end
					#end
                 </select>	
			&nbsp;&nbsp;&nbsp;&nbsp;
			 是否会员:&nbsp;
                  <select size="1"  name="isVip" id="isVip">
					 <option value="" #if (${isVip}=="") selected #end>全部</option>
					 <option value="1" #if (${isVip}=="1") selected #end>是</option>
					 <option value="0" #if (${isVip}=="0") selected #end>否</option>
                   </select>
		</div>	
		
      </div>
	 </form>
	#if($rsList)
    <div class="table_div" style="OVERFLOW-X:yes;OVERFLOW-Y:auto">
      <table class="sj_tl sj_tl_2" #if($type == 0) width="180%" #else width="160%"  #end border="0" cellspacing="0" cellpadding="0">
		<tr style="background:#ffd9b5;">
			<td align="center" >日期</td>
			<td align="center" >客户ID</td>
			<td align="center" >客户名</td>
			#if($type == 0)  <td align="center" >频道ID</td>  #end
			<td align="center" >推广频道</td>
			<td align="center" >频道类别</td>
			<td align="center" >客户所在城市</td>
			<td align="center" >竞价一级城市</td>
			<td align="center" >竞价二级城市</td>
			<td align="center" >一级类别</td>
			<td align="center" >二级类别</td>
			<td align="center" >三级类别</td>
			<td align="center" >展示位置</td>
			<td align="center" >出价</td>
			<td align="center" >业务员</td>
			<td align="center" >业务部门</td>
			<td align="center" >客户联系人</td>
			<td align="center" >客户联系电话</td>
			<td align="center" >是否会员</td>
			<td align="center" >是否购买过榜中榜</td>
			<td align="center" >是否置顶(最近3月)</td>
			<td align="center" >推广账户余额</td>
			<td align="center" >审核状态</td>
			#if($type == 0)  
				<td align="center" >PV</td>  
				<td align="center" >点击量</td>  
				<td align="center" >竞价状态（前日比）</td>  
				<td align="center" >竞价状态（后日比）</td>  
			#end
        </tr>
		
        #foreach($rs in $rsList)
		<tr onMouseOver="this.className='tdbg10'" onMouseOut="this.className='tdbg11'" class="tdbg11">
			<td align="center" >$!{rs.stat_date}</td>
			<td align="center" >$!{rs.user_id}</td>
			<td align="center" >$!{rs.user_name}</td>
			#if($type == 0)  <td align="center" >$!{rs.channel_id}</td>  #end
			<td align="center" >$!{rs.channel_name}</td>
			<td align="center" >$!{rs.channel_cate}</td>
			<td align="center" >$!{rs.order_city}</td>
			<td align="center" >$!{rs.city1}</td>
			<td align="center" >$!{rs.city2}</td>
			<td align="center" >$!{rs.cate1}</td>
			<td align="center" >$!{rs.cate2}</td>
			<td align="center" >$!{rs.cate3}</td>
			<td align="center" >$!{rs.position}</td>
			#if($type == 1)  <td align="center" >$!{rs.jingjia_amount}</td>  #end
			#if($type == 0)  <td align="center" >$!{rs.amount}</td>  #end
			<td align="center" >$!{rs.saler_name}</td>
			<td align="center" >$!{rs.saler_department}</td>
			<td align="center" >$!{rs.contact_person}</td>
			<td align="center" >$!{rs.contact_tel}</td>
			<td align="center" >#if($!{rs.is_vip}==1) 是 #else 否 #end</td>
			<td align="center" >#if($!{rs.is_bab}==1) 是 #else 否 #end</td>
			<td align="center" >#if($!{rs.is_top}==1) 是 #else 否 #end</td>
			<td align="center" >$tools.xsd($!{rs.tuiguang_amount})</td>
			<td align="center" >
				#if($!{rs.state}==0)
					成功
				#elseif($!{rs.state}==1)
					初始化参与拍卖
				#elseif($!{rs.state}==2)
					删除状态
				#elseif($!{rs.state}==3)
					出价过低
				#elseif($!{rs.state}==4)
					余额不足足
				#elseif($!{rs.state}==5)
					推广未通过审核
				#elseif($!{rs.state}==6)
					用户被封禁
				#elseif($!{rs.state}==7)
					频道被删除
				#end
			</td>
			#if($type == 0)  
				<td align="center" >$!{rs.pv}</td>  
				<td align="center" >$!{rs.click}</td>  
				<td align="center" >$!{rs.comBefore}</td>  
				<td align="center" >$!{rs.comAfter}</td>  
			#end
        </tr>
		#end
      </table>
	  </br>
	   <div align="right">
		#if($rsList.size() >0 )
		<input align="left" type="button" id="download" name="download" value="下载Excel报表"/>
		#end
		#parse("/views/default/page.vm")
        #pagebar($pList "/precision/detaildatastat?#page#&$paramurl")
	   </div>
    </div>
	#end
  </div>
  
</div>
</div>
</div>
</body>
</html>
